import * as THREE from 'three';

class TextGeometry extends THREE.ExtrudeGeometry {

	constructor( text, parameters = {} ) {

		const font = parameters.font;

		if ( ! ( font && font.isFont ) ) {
			console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' );
			return new THREE.BufferGeometry();

		}

		const shapes = font.generateShapes( text, parameters.size ); // translate parameters to THREE.ExtrudeGeometry API

		parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults

		if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
		if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
		if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
		super( shapes, parameters );
		this.type = 'TextGeometry';

	}

}

export default TextGeometry